var v = Symbol();
console.dir(v);//Symbol()
console.log(typeof v); //symbol

// 定义两个symbol()字符串
let s1 = Symbol('foo');
let s2 = Symbol("这是第二个字符串");

s1;
s2;

console.log(s1.toString());//Symbol(foo)
console.log(s2.toString());//Symbol(这是第二个字符串)

//将Symbol作为键值得三种写法 

let mySymbol = Symbol();
// 第一种
let a = {};
a[mySymbol] = "Hello";
// 第二种写法
let b = {
    [mySymbol]: "Hello",
}
// 第三种写法
let c = {};
Object.defineProperty(c, mySymbol, { value: "Hello" });

console.log(a[mySymbol], b[mySymbol], c[mySymbol]);//Hello Hello Hello